package com.itany.cloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 石小俊
 */
@RestController
@RequestMapping("/config")
// @RefreshScope注解可以实现动态更新功能
@RefreshScope
public class NacosConfigController {

    @Value("${datasource.driver}")
    private String driver;
    @Value("${datasource.url}")
    private String url;
    @Value("${datasource.username}")
    private String username;
    @Value("${datasource.password}")
    private String password;
    @Value("${info}")
    private String info;

    @RequestMapping("/getDriver")
    public String getDriver() {
        return driver;
    }

    @RequestMapping("/getUrl")
    public String getUrl() {
        return url;
    }

    @RequestMapping("/getUsername")
    public String getUsername() {
        return username;
    }

    @RequestMapping("/getPassword")
    public String getPassword() {
        return password;
    }

    @RequestMapping("/getInfo")
    public String getInfo(){
        return info;
    }
}
